﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Cxj.WPF
{
    /// <summary>
    /// CollectionWindow.xaml 的交互逻辑
    /// </summary>
    public partial class CollectionWindow : Window
    {
        public CollectionWindow()
        {
            InitializeComponent();

            List<string> list = new List<string>();
            list.Add("A000");
            list.Add("B111");
            list.Add("C222");
            list.Add("D333");
            list.Add("E444");
            this.listBox.ItemsSource = list;


            List<Employee> employees = new List<Employee>();
            employees.Add(new Employee() { Name = "AAA", Department = "D-1", Age = 19, Gender = "女" });
            employees.Add(new Employee() { IsSelected = true, Name = "BBB", Department = "D-2", Age = 20 });
            employees.Add(new Employee() { Name = "CCC", Department = "D-3", Age = 21, Gender = "男" });
            this.lv.ItemsSource = employees;


            this.dg.ItemsSource = employees;
            this.dgcb.ItemsSource = new List<string> { "男", "女" };
        }

        private void listBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            tb.Text = (sender as ListBox).SelectedItem.ToString();
        }
    }
}
